<?php 
class Code {
    
    public $key = '';
    public $tobase = 0;
    
    public $code = '';
    
    function __construct(){
        $this->key = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        $this->len = strlen($this->key);
    }
    
    function base_convert($number, $frombase = 10, $tobase = 62){
        $flag_str = substr($this->key, 0, $tobase);
        $return = '';
        
        if (!is_numeric($number)) {
        	$number = intval($number);
        }
        
        do {
            $return = $this->key[$number % $tobase] . $return;
            $number = intval($number / $tobase);
            echo $return . '===' . $number . '<br />';
        } while ($number > 0);
        
        return $return;
    }
    
}

$number = 201602241731236666664577;
// $number = '1000';
echo base_convert($number, 10, 36);
echo '<br /> --------------------------- <br />';
$obj = new Code();
echo $obj->base_convert($number);
echo '<br /> --------------------------- <br />';
$obj->getCode($number);
echo $obj->code;



